package gdr.window;


import gdr.dev.*;
import java.awt.event.KeyEvent;

/**
 * gestisce lo spostamento del cursore sul campo di battaglia, 
 * estendere questa classe per particolarizzare le reazioni in base al tasto premuto.
 * @author Giorgio Vitale
 *
 */
public class KeyManager{
	protected SuperGDR9000 gdr;
	
	public KeyManager(SuperGDR9000 gdr){
		this.gdr = gdr;
	}

	
	public void update(long elapsedTime){
		int key = gdr.bsInput.getKeyPressed();
		boolean anyKeyPressed = true;
		switch (key)
		{	case KeyEvent.VK_UP:   key_pressed_UP(); 	key_pressed_arrow(); break;
			case KeyEvent.VK_DOWN: key_pressed_DOWN(); 	key_pressed_arrow(); break;
			case KeyEvent.VK_RIGHT:key_pressed_RIGHT(); key_pressed_arrow(); break;
			case KeyEvent.VK_LEFT: key_pressed_LEFT(); 	key_pressed_arrow(); break;
			case KeyEvent.VK_ENTER:key_pressed_ENTER(); break;
			case KeyEvent.VK_ESCAPE:  key_pressed_EXIT(); break;
			default: anyKeyPressed = false;
		}
		gdr.bsInput.refresh();
		if (anyKeyPressed) key_pressed_anyKeyPressed();
	}
	
	/** tasto premuto SU*/
	protected void key_pressed_UP(){
	}
	/** tasto premuto SINISTRA*/
	protected void key_pressed_LEFT(){
	}
	/** tasto premuto DESTRA*/
	protected void key_pressed_RIGHT(){
	}
	/** tasto premuto GIU'*/
	protected void key_pressed_DOWN(){
	}
	/** tasto premuto ENTER*/
	protected void key_pressed_ENTER(){	
	}
	/** tasto premuto EXIT*/
	protected void key_pressed_EXIT(){
	}
	/** attivato se si preme un tasto freccia*/
	protected void key_pressed_arrow(){
	}
	/** attivato se viene premuto un qualunque tasto */
	protected void key_pressed_anyKeyPressed(){
	}


	public SuperGDR9000 getGdr() {
		return gdr;
	}
	public void setGdr(SuperGDR9000 gdr) {
		this.gdr = gdr;
	}
	
}